import { defHttp } from '/@/utils/http/axios';
import { ContentTypeEnum } from '/@/enums/httpEnum';

enum Api {
  GetMenuList = '/admin-api/system/menu/list',
  AddMenuList = '/admin-api/system/menu/create',
  EditMenuList = '/admin-api/system/menu/update',
  DeleteMenuList = '/admin-api/system/menu/delete',
}

/**
 * @description: 获取菜单
 */
export const getMenuList = (params: any) => {
  return defHttp.get<any>({ url: Api.GetMenuList, params });
};
export const editMenu = (params: any) => {
  return defHttp.put<any>({ url: Api.EditMenuList, params });
};
export const addMenu = (params: any) => {
  return defHttp.post<any>({ url: Api.AddMenuList, params });
};
export const deleteMenu = (params: any) => {
  return defHttp.delete<any>(
    {
      url: Api.DeleteMenuList,
      params,
      headers: { 'Content-Type': ContentTypeEnum.FORM_URLENCODED },
    },
    { joinParamsToUrl: true },
  );
};
